import React from 'react'
import { Spin } from 'antd'
import PropTypes from 'prop-types'
import styles from './index.less'

const Loading = function (props) {
  const {
    size, delay, tip, spinning, className, ...restProps
  } = props
  return (
    <div className={`${styles.loading} ${className}`} {...restProps}>
      <Spin size={size} delay={delay} tip={tip} spinning={spinning} />
    </div>
  )
}

Loading.defaultProps = {
  size: 'large',
}

Loading.PropType = {
  size: PropTypes.oneOf(['large', 'default', 'small']),
  delay: PropTypes.number,
  tip: PropTypes.string,
  spinning: PropTypes.bool,
}

export default Loading
